#include "gtest/gtest.h"

#include "filterwipe.h"
#include "filter.h"
#include "components/post.h"

using namespace Wishmaster;

namespace Wishmaster
{
	class FilterWipe;
}

class TestFilterWipe : public ::testing::Test
{
protected:
	FilterWipe* filter;

	virtual void SetUp()
	{
		filter = (new FilterWipe("testfilter"));
	}

	virtual void TearDown()
	{
		delete filter;
	}

	void testFiltration();
};

TEST_F(TestFilterWipe, Filtration)
{
	QString normal2 = "Consider tossing a coin with known, not necessarily fair, probabilities of coming up heads or tails. \
		The entropy of the unknown result of the next toss of the coin is maximized if the coin is fair (that is, if heads and tails both have equal probability 1/2). This is the situation of maximum uncertainty as it is most difficult to predict the outcome of the next toss; the result of each toss of the coin delivers a full 1 bit of information. \
		However, if we know the coin is not fair, but comes up heads or tails with probabilities p and q, then there is less uncertainty. Every time it is tossed, one side is more likely to come up than the other. The reduced uncertainty is quantified in a lower entropy: on average each toss of the coin delivers less than a full 1 bit of information.\
		The extreme case is that of a double-headed coin which never comes up tails. Then there is no uncertainty. The entropy is zero: each toss of the coin delivers no information.";
	QString normal = "Lorem ipsum dolor sit amet";
	QString normal3 = "Lorem";
	QString bad = "Lorem lorem lorem lorem lorem lorem lorem lorem";
	QString verybad = "Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet ";

	ASSERT_TRUE(!filter->checkText(normal));
	ASSERT_TRUE(!filter->checkText(normal2));
	ASSERT_TRUE(!filter->checkText(normal3));
	ASSERT_TRUE(filter->checkText(bad));
	ASSERT_TRUE(filter->checkText(verybad));

}

